#include "Aquarium.h"
#include "FishFactory.h"

#include <iostream>

using namespace std;

int main(){
	Aquarium &aquar = Aquarium::getAquarium();	
	try{
		string command;
		
		while (true){
			cout << "enter command (add/empty/pause/debug/feed/exit): ";
			cin >> command;

			if (command.compare("feed") == 0){
				aquar.feedAquarium();
				cout << " --- \n";
			} else if (command.compare("empty") == 0){
				aquar.emptyAquarium();
				cout << " --- \n";
			} else if (command.compare("pause") == 0){
				aquar.pauseAquarium();
				cout << " --- \n";
			} else if (command.compare("debug") == 0){
				aquar.debugAquarium();
				cout << " --- \n";
			} else if (command.compare("exit") == 0){
				break;
			} else if (command.compare("add") == 0){
					int locx,locy,velx,vely,type;
					cout << "enter location X:";
					cin >> locx;
					cout << "enter location Y:";
					cin >> locy;
					cout << "enter velocity X:";
					cin >> velx;
					cout << "enter velocity Y:";
					cin >> vely;

					Point loc = Point(locx,locy);
					Point vel = Point(velx,vely);	
					cout << "enter type (1=salmon,2=goldfish):";
					cin >> type;
					if (type==1){
						aquar.addFish(FishFactory::SALMON,loc,vel,false,1);
					}
					if (type==2){
						aquar.addFish(FishFactory::GOLD_FISH,loc,vel,false,1);
					}
					cout << " --- \n";

			}

		}
		
	aquar.emptyAquarium();

	}
	catch(...){
		cout << "Error occured\n";
		aquar.emptyAquarium();
	}
	
	return 1;
}